from src.core.models.dto import UserDTO
from src.database.models import User
from src.domain.user import UserEntity


def convert_db_model_to_user_dto(user: User) -> UserDTO:
    return UserDTO(
        id=user.id,
        name=user.name,
        telegram_id=user.telegram_id,
        email=user.email,
        phone=user.phone,
        onboarding=user.onboarding,
        created_at=user.created_at,
    )


def convert_db_model_to_user_entity(user: User) -> UserEntity:
    return UserEntity(
        id=user.id,
        name=user.name,
        telegram_id=user.telegram_id,
        email=user.email,
        phone=user.phone,
        onboarding=user.onboarding,
        created_at=user.created_at,
    )


def convert_user_entity_to_db_model(user: UserEntity) -> User:
    return User(
        id=user.id,
        name=user.name,
        telegram_id=user.telegram_id,
        email=user.email,
        phone=user.phone,
        onboarding=user.onboarding,
        created_at=user.created_at,
    )
